<div class="new-view view">
<h1>Assign Task to Multiple Clients</h1>

<table cellpadding=5 cellspacing= border=0 width=100%>
<% form_tag :action => 'save_task_assigned_to_multiple_clients' do %>
<% cg_options = Array.new
for cg in @client_groups   
cg_options.push([cg.name, cg.id])
end 
cg_options.insert(0,['-SELECT-',nil])
%>
<tr>
<td><label>Client Groups</label></td>
<td>&nbsp;</td>
<td>
<%= select 'task', 'client_group', 
cg_options,{},{:onClick => "
new Ajax.Request('/task/get_clients', {method: 'get', 
				parameters: 'id='+options[selectedIndex].value, 
			});"
}
%>
</td>
</tr>
<tr>
<td>
	Clients in this Group<BR> 
<div id="clients">
<%= select 'task', 'clients', {},{}, {:size => 5, :multiple => 'true'}%>
</div>
<BR/>
</center><input type="button" name="Select All Clients" value="Select All Clients" onClick="selectAllClients()">
</td>
<td><center></center><input type="button" name=">>>>" value=">>>>" onClick="getSelectedClients()"></center>
</td>
<td>
Selected Clients<BR>
<%=	select 'task', 'selected_clients', {},{},{:size => 5, :multiple => 'true'}%>
</td>
</tr>
<tr>
<td><label for="task_assignment_template_id">Assignment Master</label><br/>
</td>
<td>

<% @assignments = AssignmentTemplate.find(:all, :order => "name" ).map {|u| [u.name, u.id]}%>
<% @assignments.insert(0,['-SELECT-',nil]) %>
<%= select 'task', 'assignment_template_id', @assignments %>	
</td>
</tr>

<tr>
<td><label for="task_date_of_acceptance">Acceptance Date</label>
</td>
<td>
<%= date_select  'task', 'date_of_acceptance' %> 
</td>
</tr>

<tr>
<td><label for="task_target_date_of_completion">Target Completion Date</label>
</td>
<td>
<%= date_select  'task', 'target_date_of_completion' %>
</td>
</tr>

<tr>
<td><label for="task_employee_id">Assigned Staff</label><br/>
</td>
<td>
<% @employees = Employee.find(:all, :order => "name" ).map {|u| [u.name, u.id]}%>
<% @employees.insert(0,['-SELECT-',nil]) %>
<%= select 'task', 'employee_id', @employees %>	
</td>
</tr>
<tr>
	<td colspan=3><BR/>
		<center><%= submit_tag 'Save' %><input type="reset" name="Reset" value="Reset"></center>
	</td>
	
</tr>

</table>  
<% end %>
</div>